package com.yunti.springboot.controller;

import com.yunti.springboot.po.Class;
import com.yunti.springboot.service.ClassService;
import com.yunti.springboot.vo.Result;
import com.yunti.springboot.vo.req.ClassReq;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/class")
public class ClassController {
    @Resource
    ClassService classService;

    @PostMapping("/getAllClass")
    public Result getAllClass(@RequestBody ClassReq classReq){
        return classService.getAllClass(classReq);
    }

    @PostMapping("/getClassByYear")
    public Result getClassByYear(@RequestBody ClassReq classReq){
        return classService.getClassByYear(classReq);
    }

    @PostMapping("/getClassByGrade")
    public Result getClassByGrade(@RequestBody ClassReq classReq){
        return classService.getClassByGrade(classReq);
    }

    @PostMapping("/getAllYear")
    public Result getAllYear(){
        return classService.getAllYear();
    }

    @PostMapping("/updateClass")
    public Result updateClass(@RequestBody Class classReq){
        return classService.updateClass(classReq);
    };

    @PostMapping("deleteClass")
    public Result deleteClass(@RequestBody Class classReq){
        return classService.deleteClass(classReq);
    }

    @PostMapping("addClass")
    public Result addClass(@RequestBody Class classReq){
        return classService.addClass(classReq);
    }

    @PostMapping("/page")
    public Result page(@RequestBody ClassReq classReq){
        return classService.findPage(classReq);
    }
}
